#include<iostream>
#include "currency.h"

int main()
{
    using std::cout;
    using std::endl;
    Currency f, g(plus, 3, 45), h;
    h.setValue(-2.5);
    Currency* m = new Currency(minus, 8, 12);
    f.output(); cout << endl;
    g.output(); cout << endl;
    h.output(); cout << endl;
    m->output(); cout << endl;
    cout << "g+h:"; g.add(h).output(); cout << endl;
    cout << "g:"; g.output(); cout << endl;
    g.increment(h); cout << "g:";g.output(); cout << endl;

    Currency gg, hh(plus, 3, 50), i, j;
    gg.setValue(minus, 2, 25);
    i.setValue(-6.45);

    j = hh.add(gg);
    hh.output(); cout << " + "; gg.output(); cout << " = "; j.output(); cout << endl;

    j = i.add(gg).add(hh);
    i.output(); cout << " + "; gg.output(); cout << " + "; hh.output(); cout << " = "; j.output(); cout << endl;

    j.output(); cout << endl;
    j = i.increment(gg).add(hh);
    j.output(); cout << endl;

    cout << "Attempting to initialize with cents = 152" << endl;
    try {
        i.setValue(plus, 3, 152);
    }
    catch (illegalParameterValue e) {
        cout << "Caught an exception: " << e.what() << endl;
    }

    Currency2 k(-123.12);
    k.output(); cout << endl;
    return 0;
}
